<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <title>车辆删除页面</title>
  <link rel="stylesheet" href="../../layui-v2.6.8/layui/css/layui.css">
  <script  src="../../layui-v2.6.8/layui/layui.js"></script>
</head>
<body>
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
  <legend>车辆删除</legend>
</fieldset>
<form class="layui-form">
  <div class="layui-form-item">
    <label class="layui-form-label">车辆编号</label>
    <div class="layui-input-block">
      <input type="text" id="vid" required  lay-verify="required" placeholder="请输入车辆的编号" autocomplete="off" class="layui-input">
    </div>
  </div>
  <div class="layui-form-item">
    <div class="layui-input-block">
      <button class="layui-btn" onclick="delete_1()">删除</button>
    </div>
  </div>
</form>
<script>
  function delete_1() {
    var $=layui.$;
    var vid=$("#vid").val();
    console.log(vid);
    var data={
      "vid":vid,
    }
    var layer=layui.layer;
    var url ="http://localhost:8080/deleteVeh";
    $.ajax({
      url:url,
      type:"get",
      dataType:"json",
      async:true,
      data:data,
      success: function(data){
        console.log(data)
        if (data.code == 0) {

          layer.msg("删除成功", {icon: 6,time:1800},function (){
            // location.href = '../car/addCar.html';
          });
          window.location.href = 'carIndex.html';
        } else {
          layer.msg("删除失败", {icon: 5});
        }
        return false;
      }
    });
  }

</script>
</body>
</html>